<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <input type="text" v-model="myNum" placeholder="请输入1-100之间的整数">
    <input type="button" value="猜一猜" @click="f()">
    <div>
        结果:{{info}}
    </div>
    <script src="js/vue.min.js"></script>
    <script>
        let x = parseInt(Math.random()*100)+1;//得到1-100之间的随机整数
        let v = new Vue({
            el: "body>div",
            data: {
                info: "",
                myNum:""
            },
            methods:{
                f(){
                    if (v.myNum>x){
                        v.info = "猜大了!";
                    }else if(v.myNum<x){
                        v.info = "猜小了!"
                    }else{
                        v.info = "恭喜你猜对了!";
                    }
                }
            }
        })
    </script>
</div>
</body>
</html>